<template>

	<view class="dreame">
		<view class="searchView">
			<image src="../../static/icon/taiji.png" mode=""></image>
			<view class="inp-btn">
				<uni-easyinput suffixIcon="search" class="input" v-model="value" placeholder="请输入梦境关键字"
					@iconClick="onClick"></uni-easyinput>
				<button type="default" class="btn" size="mini" @click="onClick">解梦</button>
			</view>
		</view>
		<view class="dreame_detail">
			<view class="dreame_item" v-for="(item,index) in result" :key="index">
				<view class="title">{{item.title}}</view>
				<view class="content" v-for="(value,key) in item.list">{{key+1}}.{{value}}</view>
			</view>
		</view>


	</view>

</template>

<script>
	export default {
		data() {
			return {
				value: "",
				result:[]
						
			}
		},
		onLoad() {

		},
		methods: {
			onClick() {
				uni.request({
					url:"http://v.juhe.cn/dream/query",
					data:{
						q:this.value,
						full:1,
						key:"97a16edfc8f50a312355b209aa9386cc"
					},
					success: res => {
						this.result=res.data.result
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.dreame {
		padding-top:20rpx;
		.searchView {
			width: 100%;
			
			// background-color: #007AFF;
			text-align: center;
			position: relative;
			image{
				width: 150rpx;
				height: 150rpx;
				margin: 0 auto;
			}
			.inp-btn{
				display: flex;
				.input{
					width: 80%;
				}
				.btn{
					width: 20%;
				}
			}
		}
		.dreame_detail{
			width: 100%;
			// background-color: #999999;
			.dreame_item{
				box-sizing: border-box;
				margin-top: 30rpx;
				width: 100%;
				background:#F8F9FB;
				padding:25rpx;
				border-radius: 25rpx;
				.title{
					font-size: 40rpx;
					font-weight: 700;
					border-bottom: 1px solid #C0C0C0;
				}
				.content{
					font-size: 28rpx;
					border-bottom: 1px dashed $main;
				}
			}
			
			
		}
	}
</style>
